<style>
	.basicinfo{
		margin-top:20px;
		margin-left:15px;
		margin-bottom:5px;
		border:1px solid #46A3FF;
		width:80%;
	}
	
	.info{
		margin-top:10px;
		margin-left:20px;
		margin-bottom:10px;
	}
	
	#acc_detail label{
		font-size: 14px;
	}
	
	#acc_detail legend{
		padding: 5px 10px 0;
		margin-bottom:10px;
	}
	#acc_detail td{
		width:50%;
		text-align:left;
	}
	#acc_detail th{
		width:120px;
		text-align:left;
	}
</style>

<div id="acc_detail">
{% if account.accountType == 2 %}
<table  width="70%">
<tr><td><br></td><td><br></td><td><br></td></tr>
<tr>
			<td ><input type="button" value="查询福彩中心余额" onclick="get_detail22();"  style="margin-left:30px;border: 1px solid #3580A9;text-shadow: 0px -1px 0px #2C6AA3;font-weight: bold;font-size:15px;padding: 5px 10px;border-radius: 3px 3px 3px 3px;box-shadow: 0px 1px 5px #B2B2B2;"></td>
			
			<td colspan="2"><div style="display:none " id="id22">
			<label style="font-size:20px">您好，您在福彩中心的余额为：</label>
			<input id="id33" value="" style="font-size:20px;color:blue"></div></td>
		</tr>
		<tr><td><br></td><td><br></td><td><br></td></tr>
</table>
{% endif %}
<fieldset class="basicinfo" id="basic">
	<legend>
		<label>账户信息</label>
	</legend>
	<table class="info">
		<tr>
			<td>额度账户:&nbsp;&nbsp;&nbsp;&nbsp;</td><td>{{account.account}}</td>
		</tr>
		
		<tr>
			<td>登录名:</td>
			<td>{{account.loginname}}</td>
		</tr>
		
		<tr>
			<td>账户类型:</td><td>{{account.account_type}}</td>
		</tr>
		
		<tr>
			<td>姓名:</td>
			<td>
				{% if account.name == 'None' %}
					N/A
				{% else %}
					{{account.name}}
				{% endif %}
			</td>
		</tr>
		
		<tr>
			<td>当前余额:</td><td>{{account.balance}}</td>
		</tr>
		
		
	</table>
	<input type="hidden" id="id" value="{{account.accountType}}">
</fieldset>

<div style="display:none " id="id11">
<div class="info" style="margin-top:50px;">
	<div style="float:left">
		<label>年：</label>
		<select name="year" id="year_s">
			{% for year in years %}
				<option value="{{year.year}}">{{year.year}}年</option>
			{% endfor %}
		</select>
	</div>
	
	<div style="float:left;margin-left:10px;">
		<label>月：</label>
		<select name="month" id="month_s">
			{% for month in months %}
				<option value="{{month.month}}">{{month.month}}月</option>
			{% endfor %}
		</select>
	</div>
	<input type="button" value="查询" onclick="get_detail();"  style="margin-left:30px;border: 1px solid #3580A9;text-shadow: 0px -1px 0px #2C6AA3;font-weight: bold;font-size:10px;padding: 5px 10px;border-radius: 3px 3px 3px 3px;box-shadow: 0px 1px 5px #B2B2B2;">
    
</div>
</div>


<div style="display:none " id="recharge">
<fieldset class="basicinfo" style="margin-top:5px;">
	<legend>
		<label>充值账单</label>
	</legend>
	
	<div id="recharge_hist">
		<table class="info">
			<tr><th>充值金额</th><th>充值时间</th></tr>
			<tbody id="recharge_content">
			{% for recharge in recharges %}
				<tr><td>{{recharge.tradeAmount}}</td><td>{{recharge.tradeTime|date:'Y-m-d H:i:s'}}</td></tr>
			{% endfor %}
			</tbody>
		</table>
	</div>
</fieldset></div>


<div style="display:none " id="withdraw">
<fieldset class="basicinfo">
	<legend>
		<label>提现账单</label>
	</legend>

	<div id="withdrwa_hist">

		<table class="info">
			<tr><th>提现金额</th><th>提现时间</th></tr>
			<tbody id="withdraw_content">
			{% for withdraw in withdraws %}
				<tr><td>{{withdraw.tradeAmount}}</td><td>{{withdraw.tradeTime|date:'Y-m-d H:i:s'}}</td></tr>
			{% endfor %}
			</tbody>
		</table>
	</div>
</fieldset></div>


</div>

<script type="text/javascript">
   var obj1=document.getElementById("id").value;
   if (obj1 == 0){
        var obj=document.getElementById("id11");        
        obj.style.display=""; 
        var obj=document.getElementById("withdraw");        
        obj.style.display=""; 
        var obj=document.getElementById("recharge");
        obj.style.display="";
        }
   if (obj1 == 2){ 
        var obj=document.getElementById("id11");        
        obj.style.display=""; 
        var obj=document.getElementById("recharge");
        obj.style.display="";
        }
    
	function get_detail(){
		var year = $('#year_s').val()
		var month = $('#month_s').val()
		var accountid = {{account.id}}
		
		$.ajax({
            type:'POST',
            url:'/lottery/accounts/get_trades_detail',
            data: {'year':year,'month':month},
            dataType:'json',
            success:function(data,status){
            	tbcontent_recharge = '';
            	tbcontent_withdraw = '';
            	recharge_infos = data.recharge_infos;
            	withdraw_infos = data.withdraw_infos;
            	
            	len_recharge = recharge_infos.length;
            	len_withdraw = withdraw_infos.length;
            	for(var i=0;i<len_recharge;i++){
            		var trade_amount = recharge_infos[i].tradeAmount;
            		var trade_time = recharge_infos[i].tradeTime;
            		tbcontent_recharge += '<tr><td>'+trade_amount+'</td><td>'+ trade_time +'</td></tr>';
            	}
            	for(var i=0;i<len_withdraw;i++){
            		var trade_amount = withdraw_infos[i].tradeAmount;
            		var trade_time = withdraw_infos[i].tradeTime;
            		tbcontent_withdraw += '<tr><td>'+trade_amount+'</td><td>'+ trade_time +'</td></tr>';
            	}
            	
            	$('#recharge_content').html(tbcontent_recharge);
            	$('#withdraw_content').html(tbcontent_withdraw);
            	
            },
            error:function (req, status, error){
            	$.jBox.tip('查询失败', 'error');
            }
        });
	}
	function get_detail22(){
		$.ajax({
			type:'POST',
			dataType:"json",
			url:'/lottery/account/search22',
			//data:
    	success:function(data){
    	    var obj=document.getElementById("id22");
         obj.style.display=""; 
         var obj=document.getElementById("id33");
         obj.value=data.balance; 
		    },
			error: function(){
				$.jBox.error('系统繁忙，请稍后再试');
			}

		});
	}
</script>